home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / WLIB.ZIP / WTIME.DOC < prev    next >
Encoding:
Text File  |  1993-02-07  |  2.4 KB  |  47 lines

  1. Decisions, decisions, decisions.  I know what I need for the
  2. application that I am about to write, yet I don't want to
  3. develop a library unless I can use it again and again.  At the
  4. same time, I want a tool that will be easy to understand even
  5. for the very beginner AND something that will work the fastest
  6. and use the least memory.  A lot to ask?  It seems that when I
  7. develop new stuff, I get what I want by keeping things very
  8. simple.  I developed a huge library of date and time stuff in
  9. Turbo Pascal in 1986 (or so).  Seven years ago!  It's hard to
  10. believe that in four years of programming in C++ I never needed
  11. a date or time class.
  12.  
  13. At first I thought a class that included both time and date
  14. would be fine.  By keeping the resolution down to minutes, I
  15. could store thousands of years in a long integer.  However, I
  16. didn't think it would be clear what was happening when taking
  17. that sort of object and adding 5 to it.
  18.  
  19. I remember the evolution of my Pascal stuff lead to having a
  20. variety of records (structs) I could toss around at any time.
  21. It was faster to take a Gregorian date from the system and
  22. convert it to a string than to get the system date (in
  23. Gregorian format), convert it to Julian and then back to
  24. Gregorian so that it could then be made into a string!  OTOH,
  25. adding 7 days to a Gregorian date can be quite a nightmare!
  26. So, I have a small collection of classes:  "Date" is what we
  27. human beings are familiar with - storage is in three integers -
  28. month, day and year.  "JulianDate" doesn't really use the
  29. Julian calandar, but what we have twisted it to mean in more
  30. recent years - it is the number of days since January 1, 0000.
  31. "Time" is stored as hours, minutes and seconds.  "Moment" is
  32. what I needed for the project I'm working on and is the number
  33. of minutes since January 1, 0000 (I need to store thousands of
  34. these in memory and on disk).
  35.  
  36. Next, there is all the history about Pope Gregory the 13th.
  37. Even though he put together the calandar system we use today
  38. (complete with a leap year schedule) in 1530 (or so), it wasn't
  39. completely accepted for centuries.  There is a descrepency about
  40. when was George Washington's birthday since "The Colonies"
  41. accepted the Gregorian calendar during his lifetime and made
  42. for a difference of about 10 days.  The bottom line here is
  43. that in doing conversions, I will project back the Gregorian
  44. calendar (erroneously) to Jan 1, 0000.  It's truley accurate
  45. from the 1800's on.
  46.  
  47.